package cn.com.cetccst.datacenter.policy.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Query;

import java.util.List;

import cn.com.cetccst.datacenter.collection.dao.BaseDao;
import cn.com.cetccst.datacenter.policy.entity.ComplianceEntity;

@Dao
public interface ComplianceDao extends BaseDao<ComplianceEntity> {
    @Query("DELETE FROM " + ComplianceEntity.TABLE_NAME)
    void clearAll();

    @Query("SELECT * FROM " + ComplianceEntity.TABLE_NAME)
    LiveData<List<ComplianceEntity>> loadAll();

    @Query("SELECT * FROM " + ComplianceEntity.TABLE_NAME)
    List<ComplianceEntity> getAll();

    @Query("SELECT * FROM " + ComplianceEntity.TABLE_NAME + " WHERE `key`=:key LIMIT 1")
    ComplianceEntity getByKey(String key);

}
